#include "../source/server.hpp"

int main()
{
    Socket lst_sock;
    lst_sock.CreateServer(8085);
    while (1)
    {
        int newfd = lst_sock.Accept();
        if (newfd < 0)
        {
            continue;
        }
        DBG_LOG("ACCEPT NEW SOCKET SUCCESS");
        Socket cli_sock(newfd);
        char buf[4096] = {0};
        int n = cli_sock.Recv(buf, 4095);
        if (n < 0)
        {
            //说明读取出错
            cli_sock.Close();
            continue;
        }
        cli_sock.Send(buf, n);
        DBG_LOG("CLOSE CLIENT");
        cli_sock.Close();
    }
    lst_sock.Close();
    return 0;
}
